﻿using System;
using System.Windows;
using System.Windows.Controls;

namespace Coding4Fun.Cannon.Phone.Controls
{
	public partial class NavigationControl : UserControl
	{
		public event EventHandler<ButtonNavigationEventArgs> ButtonNavigationChanged;

		public NavigationControl()
		{
			InitializeComponent();
		}

		private void btnModeStop_Checked(object sender, RoutedEventArgs e)
		{
			OnButtonNavigationChanged(ButtonNavigation.Status);
		}

		private void btnModeDrive_Checked(object sender, RoutedEventArgs e)
		{
			OnButtonNavigationChanged(ButtonNavigation.Drive);
		}

		private void btnModeAim_Checked(object sender, RoutedEventArgs e)
		{
			OnButtonNavigationChanged(ButtonNavigation.Aim);
		}

		private void btnModeFire_Checked(object sender, RoutedEventArgs e)
		{
			OnButtonNavigationChanged(ButtonNavigation.Fire);
		}

		private void OnButtonNavigationChanged(ButtonNavigation button)
		{
			if (ButtonNavigationChanged != null)
				ButtonNavigationChanged(this, new ButtonNavigationEventArgs { NewButton = button });
		}
	}
}
